package com.apts.util;

import com.jfinal.upload.UploadFile;

public class JfinalFileUtil {

	public static String validatorFile( UploadFile uploadFileTmp ){
		String errMsg = null;
		// 单文件不得大于5M
		if( uploadFileTmp.getFile().length() > 5*1024*1024 ){
			uploadFileTmp.getFile().delete();
			return errMsg = "error|单文件不得大于5M";
		}
		if( ! uploadFileTmp.getContentType().contains("image/") ){
			uploadFileTmp.getFile().delete();
			return errMsg = "error|禁止上传非图片类文件";
		}
		return errMsg;
	}
	
}
